
************************************************************************************************
* Descriptive Figures to "Public Health Policy At Scale.."
************************************************************************************************

clear 
set more off 
set matsize 8000 
cap log close 

cd "D:\Data\workdata\707116\SIDS_RDD\"

use "SIDS_analysis_final_full.dta", clear

log using "Revision1/log_files/02 Figures Descriptive.log", replace

graph set window fontface "Georgia"

g dc_sids_oth = dc_sids + dc_all_other 


g 		mor1_exc_sids = mor1 - dc_sids_oth
replace mor1_exc_sids =0 if mor1==0 


g 		mor5_exc_sids = mor5 - dc_sids_oth
replace mor1_exc_sids =0 if mor5==0 


g m_high_ed = m_short + m_mid + m_long


g preterm = . 
replace preterm = 1 if fullterm37==0
replace preterm = 0 if fullterm37==1

global motherset "mage m_basic m_voc m_high m_immigrant" 
global childset "female border LBW fullterm37"
global outset1 "dc_sids dc_sids_oth mor1 mor5"
global outset2 "mor1_exc_sids mor5_exc_sids" 

label var  preterm "pre term"
label var LBW "low birth weight" 


***Mortality graphs*** 
*full sample 
collapse (mean) mor1 dc_sids, by(byear)

twoway (connected mor1 byear, mcolor(black) lcolor(black) ///
ylabel(,ang(90)) ymtick(#10, grid tstyle(none))  xmtick(#10, grid tstyle(none)) ytitle("Infant mortality (per 10K births)") xtitle("birth year") graphregion(color(white) fcolor(white)) plotregion(color(white))) 


graph export "Revision1/output/days/inf_mortality.png", replace width(1650) height(1200) 




twoway (connected dc_sids byear, mcolor(black) lcolor(black) ///
ylabel(,ang(90)) ymtick(#5, grid tstyle(none))  xmtick(#10, grid tstyle(none)) ytitle("SIDS mortality (per 10K births)") xtitle("birth year") graphregion(color(white) fcolor(white)) plotregion(color(white))) 


graph export "Revision1/output/days/SIDS_mortality.png", replace width(1650) height(1200) 



***APPENDIX SMOKING***

use "SIDS_analysis_final_full.dta", clear
keep if smoker!=.  
drop if byear>1996
collapse (mean) smoker, by(bym)


twoway (connected smoker bym, mcolor(black) lcolor(black) ///
ylabel(,ang(90)) ymtick(#10, grid tstyle(none))  xmtick(#10, grid tstyle(none)) ytitle("Smoking prevalence") xtitle("birth year-month") graphregion(color(white) fcolor(white)) plotregion(color(white))) 


graph export "Revision1/output/days/SIDS_smoking.png", replace width(1650) height(1200) 

